# -*- coding: utf8 -*-
# בש״ד
#
# Miramar CMS for Django - Part of the Cuba Libre Project
# Copyright (C) 2009, Joshua "jag" Ginsberg <jag@flowtheory.net>
# 
# Por mi amor, que inspira a mi cada respiración y que echa de Cuba
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

from django.conf import settings

class ApplicationSettings(object):

    def __init__(self, app_name):
        self.app_name = app_name.upper()

    def __getattribute__(self, attr):
        if attr == 'app_name':
            return super(ApplicationSettings, self).__getattribute__('app_name')
        global_name = '%s_%s' % (self.app_name, attr)
        return getattr(settings, global_name, 
                       super(ApplicationSettings, self).__getattribute__(attr))

    DEFAULT_VERSION_TAG = 'trunk'
    
    # If you're going to use a different image library application, replace
    # these with your library's equivalents
    IMAGE_MANAGER = 'miramar.ImageLibrary.on_site'
    IMAGE_DETAIL_URL_NAME = 'miramar_imagelibrary_detail'
    IMAGE_THUMB_URL_NAME = 'miramar_imagelibrary_thumb'
    CREATE_IMAGE_URL_NAME = 'miramar_imagelibrary_create'
    
    UPLOAD_IMAGE_TO = 'imagelibrary' # relative to MEDIA_ROOT
    THUMBNAIL_SIZE=(160,160)
    THUMBNAIL_PREFIX='__thumb__-'
    SMALL_IMAGE_SIZE=(320,320)
    SMALL_IMAGE_PREFIX='__small__-'

    UPLOAD_FILE_TO = 'filelibrary' # relative to MEDIA_ROOT

    JQUERY_URLSTUB = 'js/jquery.js'
    SIMPLEMODAL_JS_URLSTUB = 'js/jquery.simplemodal.js'
    PREVIEW_JS_URLSTUB = 'js/jquery.preview.js'
    
    FILE_ICONS = {'doc': ('Microsoft Word Document', 
                          'miramar/icons/page_white_office.png'),
                  'xls': ('Microsoft Excel Spreadsheet',
                          'miramar/icons/page_white_office.png'),
                  'ppt': ('Microsoft Powerpoint Presentation',
                          'miramar/icons/page_white_office.png'),
                  'png': ('PNG Image',
                          'miramar/icons/color_wheel.png'),
                  'gif': ('GIF Image',
                          'miramar/icons/color_wheel.png'),
                  'bmp': ('BMP Image',
                          'miramar/icons/color_wheel.png'),
                  'tiff': ('TIFF Image',
                          'miramar/icons/color_wheel.png'),
                  'tif': ('TIFF Image',
                          'miramar/icons/color_wheel.png'),
                  'pdf': ('PDF File',
                          'miramar/icons/page_white_acrobat.png'),
                  'zip': ('ZIP Archive',
                          'miramar/icons/package.png'),
                  'tgz': ('GZipped Tarball',
                          'miramar/icons/package.png'),
                  'tbz': ('BZip2ed Tarball',
                          'miramar/icons/package.png'),
                  'gz': ('GZipped Archive',
                          'miramar/icons/package.png'),
                  'bz2': ('BZip2ed Archive',
                          'miramar/icons/package.png'),
                  'dmg': ('Apple Disk Image',
                          'miramar/icons/package.png'),
                  'iso': ('ISO-9660 Disk Image',
                          'miramar/icons/cd.png'),
                  'jpg': ('JPEG Image',
                          'miramar/icons/camera.png'),
                  'jpeg': ('JPEG Image',
                           'miramar/icons/camera.png'),
                  'avi': ('AVI Video',
                          'miramar/icons/film.png'),
                  'mpg': ('MPEG Video',
                          'miramar/icons/film.png'),
                  'mpeg': ('MPEG Video',
                          'miramar/icons/film.png'),
                  'wmv': ('Windows Media Video',
                          'miramar/icons/film.png'),
                  'mov': ('Quicktime Video',
                          'miramar/icons/film.png'),
                  'flv': ('Adobe Flash Video',
                          'miramar/icons/film.png'),
                  'mp3': ('MP3 Audio',
                          'miramar/icons/music.png'),
                  'mp4': ('MP4 Audio',
                          'miramar/icons/music.png'),
                  'wav': ('WAV Audio',
                          'miramar/icons/music.png'),
                  'default': ('File Download',
                              'miramar/icons/page_white_go.png'),
                 }